<template>
  <div class="app-container">
    <el-form
      :model="queryParams"
      ref="queryForm"
      :inline="true"
      v-show="showSearch"
      label-width="68px"
    >
      <!-- <el-form-item label="报表名称" prop="rptName">
        <el-input
          v-model="queryParams.rptName"
          placeholder="请输入报表名称"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item> -->
      <el-form-item label="记录时间" prop="rptTime">
        <el-date-picker
          :editable="false"
          clearable
          v-model="queryParams.rptTime"
          type="daterange"
          range-separator="至"
          start-placeholder="开始日期"
          end-placeholder="结束日期"
          value-format="yyyy-MM-dd"
        >
        </el-date-picker>
      </el-form-item>
      <el-form-item label="消毒液浓度" prop="xdynd" label-width="90px">
        <el-input
          v-model="queryParams.xdynd"
          placeholder="请输入消毒液浓度"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <!-- <el-form-item label="班次开始" prop="bcks">
        <el-date-picker clearable size="small"
          v-model="queryParams.bcks"
          type="date"
          value-format="yyyy-MM-dd"
          placeholder="选择班次开始">
        </el-date-picker>
      </el-form-item>
      <el-form-item label="班次结束" prop="bcjs">
        <el-date-picker clearable size="small"
          v-model="queryParams.bcjs"
          type="date"
          value-format="yyyy-MM-dd"
          placeholder="选择班次结束">
        </el-date-picker>
      </el-form-item>

      <el-form-item label="O2指针显示" prop="o2pointer">
        <el-input
          v-model="queryParams.o2pointer"
          placeholder="请输入O2指针显示"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="O2更换时间" prop="o2replace">
        <el-date-picker clearable size="small"
          v-model="queryParams.o2replace"
          type="date"
          value-format="yyyy-MM-dd"
          placeholder="选择O2更换时间">
        </el-date-picker>
      </el-form-item>
      <el-form-item label="CO2指针显示" prop="co2pointer">
        <el-input
          v-model="queryParams.co2pointer"
          placeholder="请输入CO2指针显示"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="CO2更换时间" prop="co2replace">
        <el-date-picker clearable size="small"
          v-model="queryParams.co2replace"
          type="date"
          value-format="yyyy-MM-dd"
          placeholder="选择CO2更换时间">
        </el-date-picker>
      </el-form-item>
      <el-form-item label="灌装水一级过滤压力" prop="level1">
        <el-input
          v-model="queryParams.level1"
          placeholder="请输入灌装水一级过滤压力"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="灌装水二级过滤压力" prop="level2">
        <el-input
          v-model="queryParams.level2"
          placeholder="请输入灌装水二级过滤压力"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="灌装水三级过滤压力" prop="level3">
        <el-input
          v-model="queryParams.level3"
          placeholder="请输入灌装水三级过滤压力"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="碳滤压力(Mpa)" prop="tlyl">
        <el-input
          v-model="queryParams.tlyl"
          placeholder="请输入碳滤压力(Mpa)"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="砂滤压力(Mpa)" prop="slyl">
        <el-input
          v-model="queryParams.slyl"
          placeholder="请输入砂滤压力(Mpa)"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="灌装用水(t)" prop="gzys">
        <el-input
          v-model="queryParams.gzys"
          placeholder="请输入灌装用水(t)"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="洗盖用水(t)" prop="xgys">
        <el-input
          v-model="queryParams.xgys"
          placeholder="请输入洗盖用水(t)"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="水处理回水(t)" prop="sclhs">
        <el-input
          v-model="queryParams.sclhs"
          placeholder="请输入水处理回水(t)"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="洗盖水回水(t)" prop="xgshs">
        <el-input
          v-model="queryParams.xgshs"
          placeholder="请输入洗盖水回水(t)"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="CIP回水(t)" prop="cip">
        <el-input
          v-model="queryParams.cip"
          placeholder="请输入CIP回水(t)"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="次氯酸钠使用量(mL)" prop="clsnsyl">
        <el-input
          v-model="queryParams.clsnsyl"
          placeholder="请输入次氯酸钠使用量(mL)"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item> -->
      <el-form-item label="审核人" prop="auditor">
        <el-input
          v-model="queryParams.auditor"
          placeholder="请输入审核人"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="操作人" prop="operator">
        <UserDialog
          @dialogChange="queryParams.operator = $event.label"
          :echoValue="queryParams.operator"
          :multiple="false"
          placeholder="请选择人员"
        />
        <!-- <el-input
          v-model="queryParams.operator"
          placeholder="请输入操作人"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        /> -->
        <!--<el-select
          v-model="queryParams.operator"
          filterable
          allow-create
          placeholder="请选择操作人"
          style="width: 100%"
          @keyup.enter.native="handleQuery"
        >
          <el-option
            v-for="item in userList"
            :key="item.nickName"
            :label="item.nickName"
            :value="item.nickName"
          ></el-option>
        </el-select>-->
      </el-form-item>
      <!-- <el-form-item label="报表编码" prop="code">
        <el-input
          v-model="queryParams.code"
          placeholder="请输入报表编码"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item> -->
      <!-- <el-form-item label="工厂名称" prop="factory">
        <el-input
          v-model="queryParams.factory"
          placeholder="请输入工厂名称"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item> -->
      <!--  <el-form-item label="设备类型" prop="rptType">
        <el-select v-model="queryParams.rptType" placeholder="请选择设备类型" clearable size="small">
          <el-option label="请选择字典生成" value="" />
        </el-select>
      </el-form-item> -->
      <el-form-item>
        <el-button
          type="primary"
          icon="el-icon-search"
          size="mini"
          @click="handleQuery"
          >搜索</el-button
        >
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
          >重置</el-button
        >
      </el-form-item>
    </el-form>

    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button
          type="primary"
          plain
          icon="el-icon-plus"
          size="mini"
          @click="handleAdd"
          v-hasPermi="['productionProcess:waterdeal:add']"
          >新增</el-button
        >
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="success"
          plain
          icon="el-icon-edit"
          size="mini"
          :disabled="single"
          @click="handleUpdate"
          v-hasPermi="['productionProcess:waterdeal:edit']"
          >修改</el-button
        >
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="danger"
          plain
          icon="el-icon-delete"
          size="mini"
          :disabled="multiple"
          @click="handleDelete"
          v-hasPermi="['productionProcess:waterdeal:remove']"
          >删除</el-button
        >
      </el-col>
      <!-- <el-col :span="1.5">
        <el-button
          type="warning"
          plain
          icon="el-icon-download"
          size="mini"
          @click="handleExport"
          v-hasPermi="['productionProcess:waterdeal:export']"
          >导出</el-button
        >
      </el-col> -->
      <el-col :span="1.5">
        <el-button
          type="warning"
          plain
          icon="el-icon-s-check"
          size="mini"
          :disabled="multiple"
          @click="handleCheck"
          v-hasPermi="['productionProcess:waterdeal:check']"
          >审核</el-button
        >
      </el-col>
      <right-toolbar
        :showSearch.sync="showSearch"
        @queryTable="getList"
      ></right-toolbar>
    </el-row>

    <el-table
      v-loading="loading"
      :data="waterdealList"
      @selection-change="handleSelectionChange"
      max-height="500"
    >
      <el-table-column type="selection" width="55" align="center" />
      <el-table-column label="编号" align="center" prop="id" width="80px" />
      <!-- <el-table-column label="报表名称" align="center" prop="rptName" /> -->
      <el-table-column
        label="记录时间"
        align="center"
        prop="rptTime"
        width="180"
      >
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.rptTime, "{y}-{m}-{d}") }}</span>
        </template>
      </el-table-column>
      <el-table-column label="班次开始" align="center" prop="bcks">
      </el-table-column>
      <el-table-column label="班次结束" align="center" prop="bcjs">
      </el-table-column>
      <el-table-column label="消毒液浓度" align="center" prop="xdynd" />
      <!--  <el-table-column label="O2指针显示" align="center" prop="o2pointer" />
      <el-table-column label="O2更换时间" align="center" prop="o2replace" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.o2replace, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="CO2指针显示" align="center" prop="co2pointer" />
      <el-table-column label="CO2更换时间" align="center" prop="co2replace" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.co2replace, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="灌装水一级过滤压力" align="center" prop="level1" />
      <el-table-column label="灌装水二级过滤压力" align="center" prop="level2" />
      <el-table-column label="灌装水三级过滤压力" align="center" prop="level3" />
      <el-table-column label="碳滤压力(Mpa)" align="center" prop="tlyl" />
      <el-table-column label="砂滤压力(Mpa)" align="center" prop="slyl" />
      <el-table-column label="灌装用水(t)" align="center" prop="gzys" />
      <el-table-column label="洗盖用水(t)" align="center" prop="xgys" />
      <el-table-column label="水处理回水(t)" align="center" prop="sclhs" />
      <el-table-column label="洗盖水回水(t)" align="center" prop="xgshs" />
      <el-table-column label="CIP回水(t)" align="center" prop="cip" />
      <el-table-column label="次氯酸钠使用量(mL)" align="center" prop="clsnsyl" /> -->
      <el-table-column
        label="报表编码"
        align="center"
        prop="code"
        width="200px"
      />
      <el-table-column
        label="工厂名称"
        align="center"
        prop="factory"
        width="200px"
      />
      <el-table-column label="设备类型" align="center" prop="rptType" />
      <el-table-column label="操作人" align="center" prop="operator" />
      <el-table-column label="审核人" align="center" prop="auditor" />
      <!-- <el-table-column label="备注" align="center" prop="remark" /> -->
      <el-table-column
        label="操作"
        align="center"
        class-name="small-padding fixed-width"
        min-width="250px"
      >
        <template slot-scope="scope">
          <el-button
            size="mini"
            type="text"
            icon="el-icon-view"
            @click="excelhandleView(scope.row)"
            >导出</el-button
          >
          <el-button
            size="mini"
            type="text"
            icon="el-icon-edit"
            @click="handleUpdate(scope.row)"
            v-hasPermi="['productionProcess:waterdeal:edit']"
            >修改</el-button
          >
          <el-button
            size="mini"
            type="text"
            icon="el-icon-view"
            @click="handleView(scope.row)"
            >查看</el-button
          >

          <el-button
            size="mini"
            type="text"
            icon="el-icon-delete"
            @click="handleDelete(scope.row)"
            v-hasPermi="['productionProcess:waterdeal:remove']"
            >删除</el-button
          >
        </template>
      </el-table-column>
    </el-table>

    <pagination
      v-show="total > 0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />

    <!-- 添加或修改水处理运行日志对话框 -->
    <el-dialog
      fullscreen
      :title="title"
      :visible.sync="open"
      width="700px"
      append-to-body
      custom-class="myDialog"
    >
      <TableHeader
        @nameChange="nameChange"
        @nameChange2="nameChange2"
        :data="{
          mainTitle: '水处理运行日志记录',
          company: form.factory,
          code: form.code,
        }"
      />
      <el-form ref="form" :model="form" :rules="rules" label-width="90px">
        <el-row>
          <!-- <el-col :span="12">
                <el-form-item label="报表名称" prop="rptName">
                  <el-input v-model="form.rptName" placeholder="请输入报表名称" :disabled="openDisabled" />
                </el-form-item>
            </el-col> -->

          <el-col :span="8">
            <el-form-item label="班次开始" prop="bcks" label-width="70px">
              <!-- <el-date-picker clearable
                    v-model="form.bcks"
                    type="date"
                    value-format="yyyy-MM-dd"
                    placeholder="选择班次开始" :disabled="openDisabled">
                  </el-date-picker> -->
              <el-time-select
                :editable="false"
                v-model="form.bcks"
                :picker-options="{
                  start: '00:00',
                  step: '00:30',
                  end: '24:00',
                }"
                placeholder="选择时间"
                :disabled="openDisabled"
              >
              </el-time-select>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="班次结束" prop="bcjs" label-width="70px">
              <!-- <el-date-picker clearable
                    v-model="form.bcjs"
                    type="date"
                    value-format="yyyy-MM-dd"
                    placeholder="选择班次结束" :disabled="openDisabled">
                  </el-date-picker> -->
              <el-time-select
                :editable="false"
                v-model="form.bcjs"
                :picker-options="{
                  start: '00:00',
                  step: '00:30',
                  end: '24:00',
                }"
                placeholder="选择时间"
                :disabled="openDisabled"
              >
              </el-time-select>
            </el-form-item>
          </el-col>

          <el-col :span="8">
            <el-form-item label="记录时间" prop="rptTime" label-width="70px">
              <el-date-picker
                clearable
                :editable="false"
                v-model="form.rptTime"
                type="date"
                value-format="yyyy-MM-dd"
                placeholder="选择记录时间"
                :disabled="openDisabled"
              >
              </el-date-picker>
            </el-form-item>
          </el-col>
          <!-- <el-col :span="12">
                <el-form-item label="报表编码" prop="code">
                  <el-input v-model="form.code" placeholder="请输入报表编码" :disabled="openDisabled" />
                </el-form-item>
            </el-col>
            <el-col :span="12">
                <el-form-item label="工厂名称" prop="factory">
                  <el-input v-model="form.factory" placeholder="请输入工厂名称" :disabled="openDisabled" />
                </el-form-item>
            </el-col>
            <el-col :span="12">
                <el-form-item label="设备类型" prop="rptType">
                  <el-select v-model="form.rptType" placeholder="请选择设备类型" :disabled="openDisabled">
                    <el-option label="请选择字典生成" value="" />
                  </el-select>
                </el-form-item>
            </el-col>
            <el-col :span="24">
                <el-form-item label="备注" prop="remark">
                  <el-input v-model="form.remark" type="textarea" placeholder="请输入内容" :disabled="openDisabled" />
                </el-form-item>
            </el-col> -->
        </el-row>

        <!-- 水处理运行日志1信息 -->
        <br />
        <el-divider content-position="center">运行日志</el-divider>
        <el-row :gutter="10" class="mb8">
          <el-col :span="1.5">
            <el-button
              type="primary"
              icon="el-icon-plus"
              size="mini"
              @click="handleAddRptProWaterdeal1"
              :disabled="openDisabled"
              >添加</el-button
            >
          </el-col>
          <el-col :span="1.5">
            <el-button
              type="danger"
              icon="el-icon-delete"
              size="mini"
              @click="handleDeleteRptProWaterdeal1"
              :disabled="openDisabled"
              >删除</el-button
            >
          </el-col>
        </el-row>
        <el-divider content-position="center"></el-divider>
        <el-table
          :data="rptProWaterdeal1List"
          :row-class-name="rowRptProWaterdeal1Index"
          @selection-change="handleRptProWaterdeal1SelectionChange"
          ref="rptProWaterdeal1"
          max-height="500"
        >
          <el-table-column type="selection" width="50" align="center" />
          <!-- <el-table-column label="序号" align="center" prop="index" width="50"/> -->
          <el-table-column label="时间" prop="kssj" width="200px">
            <template slot-scope="scope">
              <el-time-picker
                clearable
                :editable="false"
                v-model="scope.row.kssj"
                value-format="HH:mm"
                format="HH:mm"
                placeholder="选择时间"
                :disabled="openDisabled"
              >
              </el-time-picker>
            </template>
          </el-table-column>
          <el-table-column label="灌装水臭氧机操作记录">
            <el-table-column label="设备运行是否正常" prop="gz1" width="160">
              <template slot-scope="scope">
                <!-- <el-input v-model="scope.row.gz1" placeholder="请输入设备运行是否正常" :disabled="openDisabled"/> -->
                <el-select v-model="scope.row.gz1" :disabled="openDisabled">
                  <el-option value="是">是</el-option>
                  <el-option value="否">否</el-option>
                </el-select>
              </template>
            </el-table-column>
            <el-table-column label="三级过滤压差" prop="gz2" width="180">
              <template slot-scope="scope">
                <el-input
                  v-model="scope.row.gz2"
                  placeholder="请输入三级过滤压差"
                  :disabled="openDisabled"
                />
              </template>
            </el-table-column>
            <el-table-column label="电流(A)" prop="gz3 " width="150">
              <template slot-scope="scope">
                <el-input
                  v-model="scope.row.gz3"
                  placeholder="请输入电流(A)"
                  :disabled="openDisabled"

                />
              </template>
            </el-table-column>
            <el-table-column label="氧气流量" prop="gz4" width="150">
              <template slot-scope="scope">
                <el-input
                  v-model="scope.row.gz4"
                  placeholder="请输入氧气流量"
                  :disabled="openDisabled"

                />
              </template>
            </el-table-column>
            <el-table-column label="臭氧浓度(mg/L)" prop="gz5" width="170">
              <template slot-scope="scope">
                <el-input
                  v-model="scope.row.gz5"
                  placeholder="请输入臭氧浓度(mg/L)"
                  :disabled="openDisabled"
                  type="number"
                />
              </template>
            </el-table-column>
          </el-table-column>
          <el-table-column label="冲盖水臭氧机操作记录">
            <el-table-column label="设备运行是否正常" prop="cg1" width="130">
              <template slot-scope="scope">
                <!-- <el-input v-model="scope.row.cg1" placeholder="请输入设备运行是否正常" :disabled="openDisabled"/> -->
                <el-select v-model="scope.row.cg1" :disabled="openDisabled">
                  <el-option value="是">是</el-option>
                  <el-option value="否">否</el-option>
                </el-select>
              </template>
            </el-table-column>
            <el-table-column label="三级过滤压差" prop="cg2" width="180">
              <template slot-scope="scope">
                <el-input
                  v-model="scope.row.cg2"
                  placeholder="请输入三级过滤压差"
                  :disabled="openDisabled"
                />
              </template>
            </el-table-column>
            <el-table-column label="水流量" prop="cg3" width="140">
              <template slot-scope="scope">
                <el-input
                  v-model="scope.row.cg3"
                  placeholder="请输入水流量"
                  :disabled="openDisabled"
                  type="number"
                />
              </template>
            </el-table-column>
            <el-table-column label="氧气流量" prop="cg4" width="150">
              <template slot-scope="scope">
                <el-input
                  v-model="scope.row.cg4"
                  placeholder="请输入氧气流量"
                  :disabled="openDisabled"
                  type="number"
                />
              </template>
            </el-table-column>
          </el-table-column>

          <el-table-column label="二氧化碳添加记录">
            <el-table-column label="水流量" prop="co2water" width="140">
              <template slot-scope="scope">
                <el-input
                  v-model="scope.row.co2water"
                  placeholder="请输入水流量"
                  :disabled="openDisabled"
                  type="number"
                />
              </template>
            </el-table-column>
            <el-table-column label="二氧化碳流量" prop="co2flow" width="150">
              <template slot-scope="scope">
                <el-input
                  v-model="scope.row.co2flow"
                  placeholder="请输入二氧化碳流量"
                  :disabled="openDisabled"
                  type="number"
                />
              </template>
            </el-table-column>
          </el-table-column>
          <el-table-column label="碳滤后余氯含量(mg/L)" prop="tlh" width="220">
            <template slot-scope="scope">
              <el-input
                v-model="scope.row.tlh"
                placeholder="请输入碳滤后余氯含量(mg/L)"
                :disabled="openDisabled"
                type="number"
              />
            </template>
          </el-table-column>
          <!-- <el-table-column label="备注" prop="remark">
            <template slot-scope="scope">
                <el-input v-model="scope.row.remark" type="textarea" placeholder="请输入内容" :disabled="openDisabled"/>
            </template>
          </el-table-column> -->
        </el-table>

        <!-- 取水供水  水处理运行日志2信息 -->
        <!-- <el-divider content-position="center"></el-divider>
        <el-row :gutter="10" class="mb8">
          <el-col :span="1.5">
            <el-button type="primary" icon="el-icon-plus" size="mini" @click="handleAddRptProWaterdeal2" :disabled="openDisabled">添加</el-button>
          </el-col>
          <el-col :span="1.5">
            <el-button type="danger" icon="el-icon-delete" size="mini" @click="handleDeleteRptProWaterdeal2" :disabled="openDisabled">删除</el-button>
          </el-col>
        </el-row> -->
        <br />
        <el-divider content-position="center">取水、供水情况</el-divider>
        <el-row :gutter="10" class="mb8">
          <el-col :span="1.5">
            <el-button
              type="primary"
              icon="el-icon-plus"
              size="mini"
              @click="handleAddRptProWaterdeal2"
              :disabled="openDisabled"
              >添加</el-button
            >
          </el-col>
          <el-col :span="1.5">
            <el-button
              type="danger"
              icon="el-icon-delete"
              size="mini"
              @click="handleDeleteRptProWaterdeal2"
              :disabled="openDisabled"
              >删除</el-button
            >
          </el-col>
        </el-row>
        <el-table
          :data="rptProWaterdeal2List"
          :row-class-name="rowRptProWaterdeal2Index"
          :span-method="objectSpanMethod"
          @selection-change="handleRptProWaterdeal2SelectionChange"
          ref="rptProWaterdeal2"
        >
          <el-table-column type="selection" width="50" align="center" />
          <!-- <el-table-column label="序号" align="center" prop="index" width="50"/> -->
          <el-table-column label="项目" prop="xm" minWidth="150">
            <template slot-scope="scope">
              <!-- <el-input
                v-model="scope.row.xm"
                placeholder="请输入项目"
                :disabled="openDisabled"
              /> -->
              <el-select v-model="scope.row.xm" :disabled="openDisabled">
                <el-option value="1#储水罐">1#储水罐</el-option>
                <el-option value="2#储水罐">2#储水罐</el-option>
              </el-select>
            </template>
          </el-table-column>
          <el-table-column label="取水开始时间" prop="getstart" minWidth="140">
            <template slot-scope="scope">
              <!-- <el-date-picker clearable size="small" v-model="scope.row.getstart" type="date"  value-format="yyyy-MM-dd"  placeholder="选择取水开始时间" :disabled="openDisabled">
                </el-date-picker> -->
              <el-time-picker
                :editable="false"
                v-model="scope.row.getstart"
                value-format="HH:mm"
                format="HH:mm"
                placeholder="任意时间点"
                :disabled="openDisabled"
              >
              </el-time-picker>
            </template>
          </el-table-column>
          <el-table-column label="取水停止时间" prop="getend" minWidth="140">
            <template slot-scope="scope">
              <!-- <el-date-picker clearable size="small" v-model="scope.row.getend" type="date"  value-format="yyyy-MM-dd"  placeholder="选择取水停止时间" :disabled="openDisabled">
                </el-date-picker> -->
              <el-time-picker
                :editable="false"
                v-model="scope.row.getend"
                value-format="HH:mm"
                format="HH:mm"
                placeholder="任意时间点"
                :disabled="openDisabled"
              >
              </el-time-picker>
            </template>
          </el-table-column>
          <el-table-column
            label="消毒液含量（mg/L)"
            prop="disinfectant"
            minWidth="180"
          >
            <template slot-scope="scope">
              <el-input
                v-model="scope.row.disinfectant"
                placeholder="请输入消毒液含量"
                :disabled="openDisabled"
              />
            </template>
          </el-table-column>
          <el-table-column
            label="供水开始时间"
            prop="providestart"
            minWidth="150"
          >
            <template slot-scope="scope">
              <!--  <el-date-picker clearable size="small" v-model="scope.row.providestart" type="date"  value-format="yyyy-MM-dd"  placeholder="选择供水开始时间" :disabled="openDisabled">
                </el-date-picker> -->
              <el-time-picker
                :editable="false"
                v-model="scope.row.providestart"
                value-format="HH:mm"
                format="HH:mm"
                placeholder="任意时间点"
                :disabled="openDisabled"
              >
              </el-time-picker>
            </template>
          </el-table-column>
          <el-table-column
            label="供水停止时间"
            prop="provideend"
            minWidth="150"
          >
            <template slot-scope="scope">
              <!-- <el-date-picker clearable size="small" v-model="scope.row.provideend" type="datetime"  value-format="HH:mm:ss"  placeholder="选择供水停止时间" :disabled="openDisabled">
                </el-date-picker> -->
              <el-time-picker
                :editable="false"
                v-model="scope.row.provideend"
                value-format="HH:mm"
                format="HH:mm"
                placeholder="任意时间点"
                :disabled="openDisabled"
              >
              </el-time-picker>
            </template>
          </el-table-column>
          <!--  <el-table-column label="备注" prop="remark">
            <template slot-scope="scope">
                <el-input v-model="scope.row.remark" type="textarea" placeholder="请输入内容" :disabled="openDisabled"/>
            </template>
          </el-table-column> -->
          <el-table-column
            label="排污开始时间"
            prop="pollutionstart"
            minWidth="150"
          >
            <template slot-scope="scope">
              <!--  <el-date-picker clearable size="small" v-model="scope.row.providestart" type="date"  value-format="yyyy-MM-dd"  placeholder="选择供水开始时间" :disabled="openDisabled">
                </el-date-picker> -->
              <el-time-picker
                :editable="false"
                v-model="scope.row.pollutionstart"
                value-format="HH:mm"
                format="HH:mm"
                placeholder="任意时间点"
                :disabled="openDisabled"
              >
              </el-time-picker>
            </template>
          </el-table-column>
          <el-table-column
            label="排污停止时间"
            prop="pollutionend"
            minWidth="150"
          >
            <template slot-scope="scope">
              <!-- <el-date-picker clearable size="small" v-model="scope.row.provideend" type="datetime"  value-format="HH:mm:ss"  placeholder="选择供水停止时间" :disabled="openDisabled">
                </el-date-picker> -->
              <el-time-picker
                :editable="false"
                v-model="scope.row.pollutionend"
                value-format="HH:mm"
                format="HH:mm"
                placeholder="任意时间点"
                :disabled="openDisabled"
              >
              </el-time-picker>
            </template>
          </el-table-column>
        </el-table>

        <!-- 结尾 -->
        <el-row>
          <el-col :span="12">
            <el-form-item label="班后管路消毒情况" label-width="280px">
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item
              label="消毒液浓度(mg/L)"
              prop="xdynd"
              label-width="160px"
            >
              <el-input
                v-model="form.xdynd"
                placeholder="请输入消毒液浓度"
                :disabled="openDisabled"
              />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item
              label="氧气指针显示(bar)"
              prop="o2pointer"
              label-width="160px"
            >
              <el-input
                v-model="form.o2pointer"
                placeholder="请输入氧气指针显示(bar)"
                :disabled="openDisabled"
              />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item
              label="氧气更换时间"
              prop="o2replace"
              label-width="160px"
            >
              <el-time-picker
                :editable="false"
                clearable
                v-model="form.o2replace"
                value-format="HH:mm"
                format="HH:mm"
                placeholder="选择氧气更换时间"
                :disabled="openDisabled"
              >
              </el-time-picker>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item
              label="二氧化碳指针显示(bar)"
              prop="co2pointer"
              label-width="160px"
            >
              <el-input
                v-model="form.co2pointer"
                placeholder="请输入二氧化碳指针显示(bar)"
                :disabled="openDisabled"
              />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item
              label="二氧化碳更换时间"
              prop="co2replace"
              label-width="160px"
            >
              <el-time-picker
                :editable="false"
                clearable
                v-model="form.co2replace"
                value-format="HH:mm"
                format="HH:mm"
                placeholder="选择二氧化碳更换时间"
                :disabled="openDisabled"
              >
              </el-time-picker>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item
              label="灌装水一级过滤压力"
              prop="level1"
              label-width="160px"
            >
              <el-input
                v-model="form.level1"
                placeholder="请输入灌装水一级过滤压力"
                :disabled="openDisabled"
              />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item
              label="灌装水二级过滤压力"
              prop="level2"
              label-width="160px"
            >
              <el-input
                v-model="form.level2"
                placeholder="请输入灌装水二级过滤压力"
                :disabled="openDisabled"
              />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item
              label="灌装水三级过滤压力"
              prop="level3"
              label-width="160px"
            >
              <el-input
                v-model="form.level3"
                placeholder="请输入灌装水三级过滤压力"
                :disabled="openDisabled"
              />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="碳滤压力(Mpa)" prop="tlyl" label-width="160px">
              <el-input
                v-model="form.tlyl"
                placeholder="请输入碳滤压力(Mpa)"
                :disabled="openDisabled"
              />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="砂滤压力(Mpa)" prop="slyl" label-width="160px">
              <el-input
                v-model="form.slyl"
                placeholder="请输入砂滤压力(Mpa)"
                :disabled="openDisabled"
              />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="8">
            <el-form-item label="计量开始时间" label-width="160px">
              <!-- <el-time-picker
                :editable="false"
                v-model="jlkssj"
                value-format="HH:mm"
                format="HH:mm"
                placeholder="任意时间点"
              /> -->

              <el-date-picker
                :editable="false"
                v-model="jlkssj"
                type="datetime"
                placeholder="选择计量开始时间"
                :disabled="openDisabled"
              >
              </el-date-picker>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="计量结束时间" label-width="160px">
              <!-- <el-time-picker
                :editable="false"
                v-model="jljssj"
                value-format="HH:mm"
                format="HH:mm"
                placeholder="任意时间点"
              /> -->
              <el-date-picker
                :editable="false"
                v-model="jljssj"
                type="datetime"
                placeholder="选择计量结束时间"
                :disabled="openDisabled"
              >
              </el-date-picker>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="操作">
              <el-button
                type="primary"
                plain
                icon="el-icon-search"
                @click="handleDate"
                :disabled="openDisabled"
                >读取数据</el-button
              >
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="灌装用水表数" prop="gzys1" label-width="160px">
              <el-input
                v-model="form.gzys1"
                placeholder="请输入灌装用水表数"
                :disabled="openDisabled"
              />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="灌装用水(t)" prop="gzys" label-width="160px">
              <el-input
                v-model="form.gzys"
                placeholder="请输入灌装用水(t)"
                :disabled="openDisabled"
              />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="洗盖用水表数" prop="xgys1" label-width="160px">
              <el-input
                v-model="form.xgys1"
                placeholder="请输入洗盖用水表数"
                :disabled="openDisabled"
              />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="洗盖用水(t)" prop="xgys" label-width="160px">
              <el-input
                v-model="form.xgys"
                placeholder="请输入洗盖用水(t)"
                :disabled="openDisabled"
              />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item
              label="水处理回水表数"
              prop="sclhs1"
              label-width="160px"
            >
              <el-input
                v-model="form.sclhs1"
                placeholder="请输入水处理回水表数"
                :disabled="openDisabled"
              />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item
              label="水处理回水(t)"
              prop="sclhs"
              label-width="160px"
            >
              <el-input
                v-model="form.sclhs"
                placeholder="请输入水处理回水(t)"
                :disabled="openDisabled"
              />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item
              label="洗盖水回水表数"
              prop="xgshs1"
              label-width="160px"
            >
              <el-input
                v-model="form.xgshs1"
                placeholder="请输入洗盖水回水表数"
                :disabled="openDisabled"
              />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item
              label="洗盖水回水(t)"
              prop="xgshs"
              label-width="160px"
            >
              <el-input
                v-model="form.xgshs"
                placeholder="请输入洗盖水回水(t)"
                :disabled="openDisabled"
              />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="CIP回水表数" prop="cip1" label-width="160px">
              <el-input
                v-model="form.cip1"
                placeholder="请输入CIP回水表数"
                :disabled="openDisabled"
              />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="CIP回水(t)" prop="cip" label-width="160px">
              <el-input
                v-model="form.cip"
                placeholder="请输入CIP回水(t)"
                :disabled="openDisabled"
              />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item
              label="次氯酸钠使用量(mL)"
              prop="clsnsyl"
              label-width="160px"
            >
              <el-input
                v-model="form.clsnsyl"
                placeholder="请输入次氯酸钠使用量(mL)"
                :disabled="openDisabled"
              />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="审核人" prop="auditor" label-width="160px">
              <el-input v-model="form.auditor" :disabled="true" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="操作人" prop="operator" label-width="160px">
              <UserDialog
                @dialogChange="form.operator = $event.label"
                :echoValue="form.operator"
                :multiple="false"
                :openDisabled="openDisabled"
                placeholder="请选择人员"
              />
              <!-- <el-input
                v-model="form.operator"
                placeholder="请输入操作人"
                :disabled="openDisabled"
              /> -->
              <!--<el-select
                v-model="form.operator"
                filterable
                allow-create
                placeholder="请选择操作人"
                style="width: 100%"
                :disabled="openDisabled"
              >
                <el-option
                  v-for="item in userList"
                  :key="item.nickName"
                  :label="item.nickName"
                  :value="item.nickName"
                ></el-option>
              </el-select>-->
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
      <div slot="footer" class="dialog-footer" v-if="!openDisabled">
        <el-button type="primary" @click="submitForm">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import {
  listWaterdeal,
  getWaterdeal,
  delWaterdeal,
  addWaterdeal,
  updateWaterdeal,
  checkWaterdeal,
  handleDate,
} from "@/api/report/process/waterdeal";

import { getInfo } from "@/api/login";
import { listUser } from "@/api/system/user";

export default {
  name: "Waterdeal",
  data() {
    return {
      /* 当前用户名 */
      nickName: "",
      userList: [],
      //弹窗是否禁止编辑
      openDisabled: true,
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 子表选中数据
      checkedRptProWaterdeal1: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 水处理运行日志表格数据
      waterdealList: [],
      // 水处理运行日志1表格数据
      rptProWaterdeal1List: [],
      // 水处理运行日志2表格数据
      rptProWaterdeal2List: [],
      // 弹出层标题
      title: "",
      jlkssj: null,
      jljssj: null,
      // 是否显示弹出层
      open: false,
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 50,
        rptName: null,
        rptTime: null,
        rptTime1: null,
        bcks: null,
        bcjs: null,
        xdynd: null,
        o2pointer: null,
        o2replace: null,
        co2pointer: null,
        co2replace: null,
        level1: null,
        level2: null,
        level3: null,
        tlyl: null,
        slyl: null,
        gzys: null,
        xgys: null,
        sclhs: null,
        xgshs: null,
        cip: null,
        gzys1: null,
        xgys1: null,
        sclhs1: null,
        xgshs1: null,
        cip1: null,
        clsnsyl: null,
        auditor: null,
        operator: null,
        code: null,
        factory: null,
        rptType: null,
      },
      // 表单参数
      form: {},
      // 表单校验
      rules: {},
    };
  },
  created() {
    this.getList();
    this.queryUserList();
  },
  methods: {
    dateFormat(date) {
      let fmt = "YYYY-mm-dd HH:MM:SS";
      let ret;
      const opt = {
        "Y+": date.getFullYear().toString(), // 年
        "m+": (date.getMonth() + 1).toString(), // 月
        "d+": date.getDate().toString(), // 日
        "H+": date.getHours().toString(), // 时
        "M+": date.getMinutes().toString(), // 分
        "S+": date.getSeconds().toString(), // 秒
        // 有其他格式化字符需求可以继续添加，必须转化成字符串
      };
      for (let k in opt) {
        ret = new RegExp("(" + k + ")").exec(fmt);
        if (ret) {
          fmt = fmt.replace(
            ret[1],
            ret[1].length == 1 ? opt[k] : opt[k].padStart(ret[1].length, "0")
          );
        }
      }
      return fmt;
    },
    handleDate() {
      if (this.jljssj == null || this.jlkssj == null) {
        this.msgError("请输入计量时间");
      } else {
        //调取接口
        let start = this.dateFormat(this.jlkssj);
        let end = this.dateFormat(this.jljssj);
        handleDate({
          startTime: start,
          stopTime: end,
        }).then((res) => {
          this.form.gzys1 = res.data.gzys_1 + "-" + res.data.gzys_2;
          this.form.xgys1 = res.data.xgys_1 + "-" + res.data.xgys_2;
          this.form.sclhs1 = res.data.sclhs_1 + "-" + res.data.sclhs_2;
          this.form.xgshs1 = res.data.xgshs_1 + "-" + res.data.xgshs_2;
          this.form.cip1 = res.data.cip_1 + "-" + res.data.cip_2;

          this.form.gzys = Number(res.data.gzys_2) - Number(res.data.gzys_1);
          this.form.xgys = Number(res.data.xgys_2) - Number(res.data.xgys_1);
          this.form.sclhs = Number(res.data.sclhs_2) - Number(res.data.sclhs_1);
          this.form.xgshs = Number(res.data.xgshs_2) - Number(res.data.xgshs_1);
          this.form.cip = Number(res.data.cip_2) - Number(res.data.cip_1);
        });
      }
    },

    /** 查询水处理运行日志列表 */
    getList() {
      this.loading = true;
      listWaterdeal(this.queryParams).then((response) => {
        this.waterdealList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    // 表单重置
    reset() {
      this.form = {
        id: null,
        rptName: null,
        rptTime: null,
        bcks: null,
        bcjs: null,
        xdynd: 10,
        o2pointer: null,
        o2replace: null,
        co2pointer: null,
        co2replace: null,
        level1: null,
        level2: null,
        level3: null,
        tlyl: null,
        slyl: null,
        gzys: null,
        xgys: null,
        sclhs: null,
        xgshs: null,
        cip: null,
        gzys1: null,
        xgys1: null,
        sclhs1: null,
        xgshs1: null,
        cip1: null,
        clsnsyl: null,
        auditor: null,
        operator: this.nickName,
        code: "LK-QF-LS1-10-009-11-01",
        factory: "青岛崂山矿泉水有限公司",
        rptType: "水处理运行",
        delFlag: null,
        remark: null,
        createBy: null,
        createTime: null,
        updateBy: null,
        updateTime: null,
      };
      this.rptProWaterdeal1List = [];
      this.rptProWaterdeal2List = [];
      this.resetForm("form");

      const myDate = new Date();
      const year = myDate.getFullYear();
      const month = myDate.getMonth() + 1;
      const day = myDate.getDate();
      this.form.rptTime = `${year}-${month}-${day}`;
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      if (this.queryParams.rptTime != null) {
        let arr = this.queryParams.rptTime;
        this.queryParams.rptTime = arr[0];
        this.queryParams.rptTime1 = arr[1];
      }

      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map((item) => item.id);
      this.single = selection.length !== 1;
      this.multiple = !selection.length;
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.reset();
      this.openDisabled = false;
      this.open = true;
      this.title = "添加水处理运行日志";
      // this.handleAddRptProWaterdeal2();
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.reset();
      this.openDisabled = false;
      // this.handleAddRptProWaterdeal2();
      const id = row.id || this.ids;
      getWaterdeal(id).then((response) => {
        this.form = response.data;
        this.rptProWaterdeal1List = response.data.rptProWaterdeal1List;
        this.rptProWaterdeal2List = response.data.rptProWaterdeal2List;
        this.open = true;
        this.title = "修改水处理运行日志";
      });
    },
    /** 查看按钮 */
    handleView(row) {
      this.reset();
      this.openDisabled = true;
      // this.handleAddRptProWaterdeal2();
      const id = row.id || this.ids;
      getWaterdeal(id).then((response) => {
        this.form = response.data;
        this.rptProWaterdeal1List = response.data.rptProWaterdeal1List;
        this.rptProWaterdeal2List = response.data.rptProWaterdeal2List;
        this.open = true;
        this.title = "查看水处理运行日志";
      });
    },
    /** 提交按钮 */
    submitForm() {
      this.$refs["form"].validate((valid) => {
        if (valid) {
          this.form.rptProWaterdeal1List = this.rptProWaterdeal1List;
          this.form.rptProWaterdeal2List = this.rptProWaterdeal2List;
          if (this.form.id != null) {
            updateWaterdeal(this.form).then((response) => {
              this.msgSuccess("修改成功");
              this.open = false;
              this.getList();
            });
          } else {
            const rLoading = this.openLoading();
            addWaterdeal(this.form)
              .then((response) => {
                this.msgSuccess("新增成功");
                this.open = false;
                rLoading.close();
                this.getList();
              })
              .catch((error) => {
                rLoading.close();
              });
          }
        }
      });
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      const ids = row.id || this.ids;
      this.$confirm(
        '是否确认删除水处理运行日志编号为"' + ids + '"的数据项?',
        "警告",
        {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning",
        }
      )
        .then(function () {
          return delWaterdeal(ids);
        })
        .then(() => {
          this.getList();
          this.msgSuccess("删除成功");
        })
        .catch(() => {});
    },
    /** 水处理运行日志1序号 */
    rowRptProWaterdeal1Index({ row, rowIndex }) {
      row.index = rowIndex + 1;
    },
    /** 水处理运行日志1添加按钮操作 */
    handleAddRptProWaterdeal1() {
      // 时间递增
      let l = this.rptProWaterdeal1List.length;
      let rq = "";
      if (l > 0 && this.rptProWaterdeal1List[l - 1].kssj != "") {
        let time = this.rptProWaterdeal1List[l - 1].kssj;
        const arr = time.split(":");
        if (Number(arr[0]) <= 22) {
          rq = Number(arr[0]) + 1 + ":" + arr[1];
        } else {
          rq = "00:" + arr[1];
        }
      }

      let obj = {};
      obj.kssj = rq;
      obj.gz1 = "是";
      obj.gz2 = "<0.1";
      obj.gz3 = "0.7";
      obj.gz4 = "4";
      obj.gz5 = "";
      obj.cg1 = "是";
      obj.cg2 = "<0.1";
      obj.cg3 = "8";
      obj.cg4 = "3.5";
      obj.co2water = "无";
      obj.co2flow = "无";
      obj.tlh = "";
      obj.remark = "";
      this.rptProWaterdeal1List.push(obj);
    },
    /** 水处理运行日志1删除按钮操作 */
    handleDeleteRptProWaterdeal1() {
      if (this.checkedRptProWaterdeal1.length == 0) {
        this.$alert("请先选择要删除的水处理运行日志1数据", "提示", {
          confirmButtonText: "确定",
        });
      } else {
        this.rptProWaterdeal1List.splice(
          this.checkedRptProWaterdeal1[0].index - 1,
          1
        );
      }
    },
    /** 单选框选中数据 */
    handleRptProWaterdeal1SelectionChange(selection) {
      if (selection.length > 1) {
        this.$refs.rptProWaterdeal1.clearSelection();
        this.$refs.rptProWaterdeal1.toggleRowSelection(selection.pop());
      } else {
        this.checkedRptProWaterdeal1 = selection;
      }
    },
    /** 水处理运行日志2序号 */
    rowRptProWaterdeal2Index({ row, rowIndex }) {
      row.index = rowIndex + 1;
    },
    /** 水处理运行日志21添加按钮操作 */
    handleAddRptProWaterdeal2() {
      /* const l = [1, 1, 2, 2];
      l.forEach((item) => {
        let obj = {};
        obj.xm = item + "#储水罐";
        obj.getstart = "";
        obj.getend = "";
        obj.disinfectant = "";
        obj.providestart = "";
        obj.provideend = "";
        obj.remark = "";
        this.rptProWaterdeal2List.push(obj);
      }); */
      let obj = {};
      obj.xm = "";
      obj.getstart = "";
      obj.getend = "";
      obj.disinfectant = "";
      obj.providestart = "";
      obj.provideend = "";
      obj.pollutionstart = "";
      obj.pollutionend = "";
      obj.remark = "";
      this.rptProWaterdeal2List.push(obj);
    },
    /** 水处理运行日志2删除按钮操作 */
    handleDeleteRptProWaterdeal2() {
      if (this.checkedRptProWaterdeal2.length == 0) {
        this.$alert("请先选择要删除的水处理运行日志2数据", "提示", {
          confirmButtonText: "确定",
        });
      } else {
        this.rptProWaterdeal2List.splice(
          this.checkedRptProWaterdeal2[0].index - 1,
          1
        );
      }
    },
    /** 单选框选中数据 */
    handleRptProWaterdeal2SelectionChange(selection) {
      if (selection.length > 1) {
        this.$refs.rptProWaterdeal2.clearSelection();
        this.$refs.rptProWaterdeal2.toggleRowSelection(selection.pop());
      } else {
        this.checkedRptProWaterdeal2 = selection;
      }
    },
    /** 导出按钮操作 */
    handleExport() {
      this.download(
        "productionProcess/waterdeal/export",
        {
          ...this.queryParams,
        },
        "水处理运行日志" + this.parseTime(new Date()) + ".xlsx"
      );
    },
    excelhandleView(row) {
      this.download(
        "Laboratory/waterdeal/exportexcel?id=" + row.id,
        {
          ...this.queryParams,
        },
        "水处理运行日志" + this.parseTime(new Date()) + ".xlsx"
      );
    },
    //接收编号
    nameChange(e) {
      this.form.code = e;
    },
    nameChange2(e) {
      this.form.factory = e;
    },
    /** 合并行  */
    objectSpanMethod({ row, column, rowIndex, columnIndex }) {
      if (columnIndex === 0) {
        // if (rowIndex % 2 === 0) {
        //   return {
        //     rowspan: 2,
        //     colspan: 1,
        //   };
        // } else {
        //   return {
        //     rowspan: 0,
        //     colspan: 0,
        //   };
        // }
      }
    },
    /** 审核按钮操作 */
    handleCheck(row) {
      /* 审核 */
      this.ids.forEach((id) => {
        getWaterdeal(id).then((response) => {
          if (response.data.auditor != null && response.data.auditor != "") {
            this.msgError(
              '编号为"' + id + '"的数据项已审核完成，无需重复审核！'
            );
          } else {
            let obj = {};
            obj.id = id;
            obj.auditor = this.nickName;
            obj.rptProWaterdeal1List = this.rptProWaterdeal1List;
            obj.rptProWaterdeal2List = this.rptProWaterdeal2List;
            /* 修改 */
            checkWaterdeal(obj).then((response) => {
              this.msgSuccess('编号为"' + id + '"的数据项审核成功！');
              this.getList();
            });
          }
        });
      });
    },
    /* 查询用户列表 */
    queryUserList() {
      listUser().then((response) => {
        this.userList = response.rows;
      });
      getInfo().then((response) => {
        this.nickName = response.user.nickName;
      });
    },
  },
};
</script>
